import { Graph } from '@antv/x6'
import { CustomElectric } from './electric'
import { CustomLine } from './line'

const shape = {
  CustomElectric,
  CustomLine
}

function toLine(string) {
  return (string[0] + string.substr(1).replace(/([A-Z])/g, '-$1')).toLowerCase()
}
export function register() {
  Object.keys(shape).forEach((key) => {
    Graph.registerNode(toLine(key), shape[key], key === 'CustomLine')
  })
}

export function unregister() {
  Object.keys(shape).forEach((key) => {
    Graph.unregisterNode(toLine(key))
  })
}
